package cn.suiwei.stub;

import cn.suiwei.service.TimeService;
import lombok.extern.slf4j.Slf4j;

import java.time.LocalDateTime;
/**本地存根
 * @author suiwei
 * @date 2023-03-20 13:46
 */
@Slf4j
public class TimeServiceStub implements TimeService {
    private final TimeService timeService;

    /**
     * dubbo自动创建本地存根对象，传入得是TimeService的远程代理对象
     * @param timeService
     */
    public TimeServiceStub(TimeService timeService) {
        this.timeService = timeService;
    }

    @Override
    public LocalDateTime getTime() {
        log.info("调用了timeService的Stub...");
        //验证参数等操作
        if(true){
            return timeService.getTime();
        }
        return null;
    }
}
